package com.mall.product.service;

import com.mall.common.core.text.Convert;
import com.mall.common.utils.DateUtils;
import com.mall.product.domain.entity.ProColorGroup;
import com.mall.product.mapper.ProColorGroupMapper;
import com.mall.system.domain.entity.SysPost;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 颜色组Service业务层处理
 *
 * @author zhonglin
 * @date 2020-04-29
 */
@Service
public class ProColorGroupService {

  @Autowired
  private ProColorGroupMapper proColorGroupMapper;

  /**
   * 查询颜色组
   *
   * @param colorGroupId 颜色组ID
   *
   * @return 颜色组
   */
  public ProColorGroup selectProColorGroupById(Long colorGroupId) {

    return proColorGroupMapper.selectProColorGroupById(colorGroupId);
  }

  /**
   * 查询颜色组列表
   *
   * @param proColorGroup 颜色组
   *
   * @return 颜色组
   */
  public List<ProColorGroup> selectProColorGroupList(ProColorGroup proColorGroup) {

    return proColorGroupMapper.selectProColorGroupList(proColorGroup);
  }

  /**
   * 新增颜色组
   *
   * @param proColorGroup 颜色组
   *
   * @return 结果
   */
  public int insertProColorGroup(ProColorGroup proColorGroup) {

    proColorGroup.setCreateTime(DateUtils.getNowDate());
    return proColorGroupMapper.insertProColorGroup(proColorGroup);
  }

  /**
   * 修改颜色组
   *
   * @param proColorGroup 颜色组
   *
   * @return 结果
   */
  public int updateProColorGroup(ProColorGroup proColorGroup) {

    proColorGroup.setUpdateTime(DateUtils.getNowDate());
    return proColorGroupMapper.updateProColorGroup(proColorGroup);
  }

  /**
   * 删除颜色组对象
   *
   * @param ids 需要删除的数据ID
   *
   * @return 结果
   */
  public int deleteProColorGroupByIds(String ids) {

    return proColorGroupMapper.deleteProColorGroupByIds(Convert.toStrArray(ids));
  }

  /**
   * 删除颜色组信息
   *
   * @param colorGroupId 颜色组ID
   *
   * @return 结果
   */
  public int deleteProColorGroupById(Long colorGroupId) {

    return proColorGroupMapper.deleteProColorGroupById(colorGroupId);
  }

  /**
   * 查询所有颜色组
   *
   * @return 颜色组列表
   */
  public List<ProColorGroup> selectColorGroupAll() {

    return proColorGroupMapper.selectColorGroupAll();
  }

}
